﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FLCP
{
    internal class ShuangSeQiu
    {
        public int RedBallMinValue = 1;
        public int RedBallMaxValue = 33;
        public int RedBallCount = 6;

        public int BlueBallMinValue = 1;
        public int BlueBallMaxValue = 16;
        public int BludBallCount = 1;

        public List<int> GeneratedRedBalls;
        public List<int> GeneratedBlueBalls;

        private static List<int> Generate(int min, int max, int count)
        {
            var rand = new Random();
            var list = new List<int>(count);

            while (list.Count < count)
            {
                var ball = rand.Next(min, max);
                if (!list.Contains(ball))
                    list.Add(ball);
            }

            return list;
        }

        public void Generate()
        {
            GeneratedRedBalls = Generate(RedBallMinValue, RedBallMaxValue, RedBallCount);
            GeneratedBlueBalls = Generate(BlueBallMinValue, BlueBallMaxValue, BludBallCount);
        }
    }
}
